<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <style>
        table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;margin: auto}
        th,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
        th{font-weight:bold;}
        body{text-align: center}
    </style>
    {% load static %}
    <script type='text/javascript' src="/static/js/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#register").click(function(){
                $("#dataForm").attr("action","/registerPage/");
                $("#dataForm").submit();
            });
            $("#login").click(function(){
                var userName = $("#userName").val();
                var passWord = $("#password").val();
                if(userName=='' || passWord==''){
                    alert('请输入必要信息');
                    return false;
                }
                $("#dataForm").attr("action","/login/");
                $("#dataForm").submit();
            });
        });
    </script>
</head>
<body>
    <form name="dataForm" id="dataForm" method="post">
        {% csrf_token %}
        <table>
            <tr>
                <td>用户名:</td>
                <td><input id="userName" name="userName"></td>
            </tr>
            <tr>
                <td>密&nbsp;&nbsp;&nbsp;码:</td>
                <td><input id="password" name="password" type="password"></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <button name="login" id="login">登录</button>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>